﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Iptv.UploadResourceItem.Model
{
    /// <summary>
    /// 分发服务配置
    /// </summary>
    public class LoadConfig
    {
        /// <summary>
        /// 配置文件版本
        /// </summary>
        /// <remarks>不同版本使用不同的业务规则</remarks>
        public string ConfigVersion { get; set; }
        /// <summary>
        /// 分发服务唯一标记
        /// </summary>
        public string DistributeSrvTag { get; set; }
        /// <summary>
        /// 任务采集类型
        /// </summary>
        public string TaskDistributeType { get; set; } = "GET";
        /// <summary>
        /// 任务采集主机地址
        /// </summary>
        public string TaskDistributeHost { get; set; }
        /// <summary>
        /// 任务上报类型
        /// </summary>
        public string TaskReportType { get; set; } = "POST";
        /// <summary>
        /// 任务上报主机地址
        /// </summary>
        public string TaskReport { get; set; }
        /// <summary>
        /// 任务上报信息模板
        /// </summary>
        public string TaskReportTemplate { get; set; }
        /// <summary>
        /// 任务重试次数
        /// </summary>
        public int TaskRedoTimes { get; set; } = 3;
        /// <summary>
        /// 下发节点CP标记 需更新FTP地址的节点
        /// </summary>
        public List<NodeSpecial>  RandomNodeTag { get; set; }
        /// <summary>
        /// 跳过CP节点 不处理
        /// </summary>
        public string[] SkipNodeTag { get; set; }
        /// <summary>
        /// 上传任务每次读取缓存大小
        /// </summary>
        public int UploadCache { get; set; } = 3;
        /// <summary>
        /// 任务最大数量
        /// </summary>
        public int MaxTaskCount { get; set; } = 5;
        /// <summary>
        /// 相同CP账号的下可执行最大任务数量 避免同一CP的内容大批量下发时把FTP拖死
        /// </summary>
        public int SameTagMaxCount { get; set; } = 5;
        /// <summary>
        /// 图片文件下载前缀 图片文件需要先下载到本地临时目录，再进行上传，上传完成后需要删除
        /// </summary>
        public string PictureUrlPrefix { get; set; }
        /// <summary>
        /// 临时文件存储目录
        /// </summary>
        public string TempDirectory { get; set; }
    }

    /// <summary>
    /// 例外处理CP节点
    /// </summary>
    /// <remarks>随机FTP支持</remarks>
    public class NodeSpecial
    {
        /// <summary>
        /// CP标记 与MRS中一致
        /// </summary>
        public string Tag { get; set; }
        /// <summary>
        /// 上传主机信息集合
        /// </summary>
        public string[] UploadHosts { get; set; }
    }
}
